<html>
<head>
<title>Magnetic Scrabble Poetry</title>
<style type="text/css">
<!--
html, body {
  margin: 0;
  padding: 0;
  background: #888888;
  color: white;
}

.line{
  position: relative;
  padding-top: 20px;
  padding-left: 20px;
}

.drag {
  background: white;
  color: black;
  position: relative;
  cursor: pointer;
  cursor: hand;
  border: outset;
  border-width: 2px;
  padding: 3px;
  font-size: 12px;
  font-family: monospace;
}
-->
</style>
<script type="text/javascript">
<!--

String.prototype.trim = function(){
  return this.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

// query string parser from javascript.faqts.com
function parseQueryString (str) {
  str = str ? str : location.search;
  var query = str.charAt(0) == '?' ? str.substring(1) : str;
  var args = new Object();
  if (query) {
    var fields = query.split('&');
    for (var f = 0; f < fields.length; f++) {
      var field = fields[f].split('=');
      args[unescape(field[0].replace(/\+/g, ' '))] = 
unescape(field[1].replace(/\+/g, ' '));
    }
  }
  return args;
}

function getWords(){
  args = parseQueryString();
  var words = args.words;
  if (!words){
    words = "please enter a search string/so I can find your words"
  }else{
    
  }
  var lines = words.split('/');
  var wordlist = new Array();
  for (var i = 0; i < lines.length; i++){
    var linewords = lines[i].split(" ");
    for (var j = 0; j < linewords.length; j++){
      var word = linewords[j].trim();
      if (!word) continue;
      linewords[j] = '<span class="drag">' + linewords[j] + '</span>';
    }
    wordlist.push('<div class="line">' + linewords.join('') + '</div>');
  }
  return wordlist.join('');
}

//Generic Drag Script-  Dynamic Drive (www.dynamicdrive.com)
//For full source code and terms of usage,
//visit http://www.dynamicdrive.com

var ie=document.all
var ns6=document.getElementById&&!document.all

var dragapproved=false
var z,x,y

function move(e){
if (dragapproved){
z.style.left=ns6? temp1+e.clientX-x: temp1+event.clientX-x
z.style.top=ns6? temp2+e.clientY-y : temp2+event.clientY-y
return false
}
}

function drags(e){
if (!ie&&!ns6)
return
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "HTML" : "BODY"

while (firedobj.tagName!=topelement&&firedobj.className!="drag"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.className=="drag"){
dragapproved=true
z=firedobj
temp1=parseInt(z.style.left+0)
temp2=parseInt(z.style.top+0)
x=ns6? e.clientX: event.clientX
y=ns6? e.clientY: event.clientY
document.onmousemove=move
return false
}
}
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")
//-->
</script>
</head>
<body>
<p>Example Scrabble Poems: |<a
href="?words=ether+angel+tumor+penny+loan+fa+icier%2Foval+zero+fossils+wider%2Fadobe+fare+slut+indexes%2Fmops+quieted+clown+fang%2F+towing+arena+both+chairmen%2Fduke+zero+jaunty+bare+dive+or">ether
angel</a>|<a
href="?words=rough+sojourn+emu+square+divided+knelt%2Fsimple+each+sheet+feat+pilots+dream%2Frainy+faery+ray+renown+orbs%2F+beg+blazing+voice+guided+wife%2Fvisit+it+tax+tat+woe">rough
sojourn</a>|<a
href="?words=urgent+fable+vapor+orb+affix+axle%2Fcabal+alarm+haunt+whiner+thinks%2Fstowed+hints+joint+seige+dozer%2Fpyramid+energy+sneezed+cove%2Fstove+tint+cools+squid+door">urgent
fable</a>|</p>

<form action="" method="GET">
<strong>Words:</strong> (separate lines by "/") 
<input name="words" size="60"/> (Note: you can bookmark the results) [<a
href="javascript:void(alert('Template by Mark Pilgrim, some scripts from
javascript.faqts.com and www.dynamicdrive.com.  View source for
details.'))">About</a>]
</form>
<script type="text/javascript">
document.write(getWords());
</script>

</body>
</html>


